package com.test.springboot3.springboot3testdemo1.config;

import com.test.springboot3.springboot3testdemo1.entity.OtherMember;
import com.test.springboot3.springboot3testdemo1.servlet.RegisterServlet;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/7/19-下午6:11
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Configuration
public class BeanConfigure {
  @Bean
  @ConfigurationProperties(prefix = "member")
  public OtherMember otherMember() {
    return new OtherMember();
  }

  @Bean
  public ServletRegistrationBean registerServlet() {
    ServletRegistrationBean servletRegistrationBean =
        new ServletRegistrationBean(new RegisterServlet(), "/registerServlet");
    servletRegistrationBean.addInitParameter("name", "javastack");
    servletRegistrationBean.addInitParameter("sex", "male");
    return servletRegistrationBean;
  }
}
